import type { Pageable } from '~/utils/request'

export interface UserInfo {
  id: number | string
  username: string
  nickname: string
  avatar: string
  roles?: (string | number)[]
}

export interface User {
  id: number | string
  name: string
  sex: number | string
  phone: string
  address: string
}
export type UserListParams = Partial<User & Pageable>
export const getUserInfoApi = () => {
  // return useGet<UserInfo>('/user/info')
  return new Promise((resolve) => {
    resolve({
      code: 200,
      msg: '获取成功',
      data: {
        id: 1,
        username: 'admin',
        nickname: '超级管理员',
        avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
        roles: ['ADMIN'],
      },
    })
  })
}

export const userList = (params: UserListParams) => {
  return usePost<User>('/user/list', params)
}
